-
-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release/v2.0.2 #877
Merged
Merged
Release/v2.0.2 #877
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
See: https://webpack.js.org/guides/tree-shaking/ Summary, new sideEffects field helps with dead code elimination with webpack and helps build performance since it doesn't need to parse it with terser. I tested a really simple example in CRA that was just: ```diff import React from "react"; import logo from "./logo.svg"; +import { Button } from "react-md"; import "./App.css"; function App() { return ( <div className="App"> <header className="App-header"> <img src={logo} className="App-logo" alt="logo" /> <p> Edit <code>src/App.js</code> and save to reload. </p> + <Button>Hello</Button> ``` ```diff import React from "react"; import ReactDOM from "react-dom"; +import "react-md/dist/css/react-md.blue-teal-400-dark.min.css"; import "./index.css"; ``` Where I'd build with and without the react-md styles being imported. I think these stats will be negligible once more components are being used, but here's the few results with my MacBook. Current build stats: ```sh # without css # average build time ~12s File sizes after gzip: 205.54 KB build/static/js/2.646bee91.chunk.js 777 B build/static/js/runtime-main.b9cd606a.js 682 B build/static/js/main.909a8f83.chunk.js 547 B build/static/css/main.5f361e03.chunk.css ``` ```sh # with css # average build time ~13s File sizes after gzip: 205.54 KB build/static/js/2.06a718b5.chunk.js 15.84 KB build/static/css/2.c416ebf1.chunk.css 777 B build/static/js/runtime-main.b9cd606a.js 685 B build/static/js/main.5a2d7e96.chunk.js 547 B build/static/css/main.5f361e03.chunk.css ``` With `"sideEffects": ["dist/**/*"]`: ```sh # without css # average build time ~8s File sizes after gzip: 45.79 KB (-159.75 KB) build/static/js/2.5e21dda9.chunk.js 777 B build/static/js/runtime-main.b9cd606a.js 672 B (-10 B) build/static/js/main.5c471371.chunk.js 547 B build/static/css/main.5f361e03.chunk.css # stats compared to previous without css build ``` ```sh # with css # average build time ~9 File sizes after gzip: 45.8 KB (-159.75 KB) build/static/js/2.043fb57c.chunk.js 15.84 KB build/static/css/2.c416ebf1.chunk.css 777 B build/static/js/runtime-main.b9cd606a.js 673 B (-12 B) build/static/js/main.5e1aaad3.chunk.js 547 B build/static/css/main.5f361e03.chunk.css # stats compared to previous with css build ```
Also changed the SimpleListItem due to jsx-a11y/role-supports-aria-props
Codecov Report
@@ Coverage Diff @@
## master #877 +/- ##
==========================================
+ Coverage 88.59% 88.61% +0.02%
==========================================
Files 238 238
Lines 6813 6809 -4
Branches 1731 1729 -2
==========================================
- Hits 6036 6034 -2
Misses 697 697
+ Partials 80 78 -2
Continue to review full report at Codecov.
|
Updated the sideEffects to be a multiline array since changing a dependency later will automatically format it this way.
Looks like the styles one was failing or something else.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Tree shaking improvements with Webpack +
sideEffects
and build speed improvementsSee: https://webpack.js.org/guides/tree-shaking/
Summary, new sideEffects field helps with dead code elimination with webpack and helps build performance since it doesn't need to parse it with terser.
I tested a really simple example in CRA that was just:
import React from "react"; import ReactDOM from "react-dom"; +import "react-md/dist/css/react-md.blue-teal-400-dark.min.css"; import "./index.css";
The tests were run by triggering a production build with and without the
react-md
styles being included. I think these stats will be negligible once more components are being used, but here's the few results with my MacBook.Current build stats:
With
"sideEffects": ["dist/**/*"]
:NextJS build stats for documentation site
WIth
sideEffects: ["dist/**/*"]
So there is a
9.62%
build time decrease for a "clean" next build (478 s
to432 s
) and a4.42%
decrease for subsequent builds (430 s
to411 s
). The "First Load JS shared by all" decreased by40.67%
(327 kB
to194 kB
).Going to try this in "prod" for a bit before releasing to make sure I really don't have any side effects other than CSS files since there still isn't a 100% fool-proof way to know this.